package com.zzw.thread;

public class IncTest {

	private volatile static int i = 0;
	
	public static void main(String[] args) throws InterruptedException {
		Thread t = new Thread(){
			public void run(){
				for(int j = 0;j < 1000;j++){
					i++;
				}
			}
		};
		Thread b = new Thread(){
			public void run(){
				for(int j = 0;j < 1000;j++){
					i--;
				}
			}
		};
		t.start();
		b.start();
		t.join();
		b.join();
		System.out.println(i);
	}
}
